<template>
  <!-- 每一篇文章   不同的图片格式  条件渲染 -->

  <!-- 没有图片 -->
  <van-cell
    v-if="articleInfo.cover.type == 0"
    :title="articleInfo.title"
    :label="label"
  />
  <!-- 一张图片 -->
  <van-cell
    v-else-if="articleInfo.cover.type == 1"
    :title="articleInfo.title"
    :label="label"
  >
    <van-image width="150" height="75" :src="articleInfo.cover.images[0]" />
  </van-cell>
  <!-- 三张图片 -->
  <van-cell v-else :title="articleInfo.title" :label="label">
    <van-image
      v-for="(item, index) in articleInfo.cover.images"
      :key="index"
      width="33%"
      height="60"
      :src="item"
    />
  </van-cell>
</template>

<script>
export default {
  props: {
    articleInfo: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    label() {
      const art = this.articleInfo
      return `${art.aut_name} ${art.comm_count}评价 ${art.pubdate}`
    }
  }
}
</script>

<style></style>
